<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>

<html>
    <head>
        <title>编辑话题</title>
        <link rel="icon" href="${pageContext.request.contextPath}/images/kaifamiao.jpg" type="image/x-icon">
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/images/kaifamiao.jpg" type="image/x-icon" media="screen">
        <%-- 链接外部样式文件(bootstrap样式) --%>
        <link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.css">
        <%-- 链接外部样式文件(Simditor样式) --%>
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/simditor/styles/simditor.css" />
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/styles/editor.css">
        <%-- 导入外部JavaScript脚本 --%>
        <script type="text/javascript" src="${pageContext.request.contextPath}/simditor/scripts/jquery.min.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/simditor/scripts/module.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/simditor/scripts/hotkeys.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/simditor/scripts/uploader.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/simditor/scripts/simditor.js"></script>
    </head>
    <body>

        <%-- 利用JSP标准动作实现包含操作 --%>
        <jsp:include page="/WEB-INF/pages/commons/status.jsp"></jsp:include>

        <jsp:include page="/WEB-INF/pages/commons/head.jsp"></jsp:include>

        <div class="container">
            <h4>编辑话题</h4>
            <form action="/topic/update" method="post">
                <input type="hidden" name="id" value="${ topic.id }">
                <div class="editor-wrapper">
                    <input type="text" name="title" value="${ topic.title }" placeholder="标题" autofocus>
                    <textarea name="content" placeholder="内容" id="editor">${ topic.content }</textarea>
                </div>
                <div class="row button-wrapper">
                    <span class="col-4 offset-8" style="text-align: right ">
                        <button type="submit" class="btn btn-primary">确定</button>
                    </span>
                </div>
            </form>
        </div>

        <script type="text/javascript">
            let editor = new Simditor({
                textarea: $('#editor')
                //optional options
            });
        </script>

        <jsp:include page="/WEB-INF/pages/commons/foot.jsp"></jsp:include>

    </body>
</html>
